// generic mixins
@import (reference) "./mixins";
@import (reference) "./variables";
@import (reference) "~ui/styles/bootstrap/bootstrap";
@import "./react-input-range";
@import "./react-select";

html,
body {
  .flex-parent();
  height: 100%;
  margin: 0;
}

label > small {
  font-weight: normal;
}

.small {
  font-size: 0.9em !important;
}
.smaller {
  font-size: 0.8em !important;
}
.smallest {
  font-size: 0.7em !important;
}

// Colors available for font awesome icons, these might not look good with normal text
.text-color-primary {
  color: @brand-primary;
}

.text-color-info {
  color: @brand-info;
}

.text-color-success {
  color: @brand-success;
}

.text-color-warning {
  color: @brand-warning;
}

.text-color-danger {
  color: @brand-danger;
}

.text-monospace {
  font-family: @font-family-monospace;
}

code {
  word-break: break-all;
  word-wrap: break-word;
}

ul.navbar-inline li {
  display: inline;
}

.tooltip {
  font-size: 8pt;
  font-weight: normal;
  opacity: 90%;
}

  .tooltip-inner {
    word-break: normal;
    word-wrap: break-word;
    white-space: normal;
  }

.content {
  .real-flex-parent(@flow: row nowrap);
  width: 100%;
  height: 100%;
  overflow: hidden;

  > nav {
    z-index: 1;

    .navbar-right {
      margin-right: 0 !important;
    }
  }
}

.application {
  .flex-parent(@shrink: 0);
  position: relative;
  z-index: 0;
  background-color: @white;
}

.top-fixed {
  position: fixed;
  bottom: 0px;
}

.checkbox label {
  display: flex;
  align-items: center;
  padding-left: 0;

  input[type="checkbox"] {
    float: none;
    margin: 0 4px;
    position: static;
  }
}

notifications {
  z-index: 1;
}

//== Subnav
//
// Use for adding a subnav to your app
.navbar {
  margin-bottom: 0px!important;
}

a {
  // overriden by next rule for a tags that actually have an href
  cursor: default;
}

.link, [ng-click], [clip-copy], [href], [confirm-click] {
  cursor: pointer;
}

.application,
.app-container {
  > * {
    position: relative;
  }

  .kibana-nav-options {
    padding-bottom: 0;
    padding-right: 0px;

    kbn-global-timepicker {
      line-height: 20px;
    }

    .kibana-nav-actions {
      margin-left: auto;
      padding-right: 0;
      line-height: 20px;
    }
  }

  > config {
    z-index: 1;
  }
  > navbar { padding-bottom: 4px; }
  > kbn-top-nav { z-index: @localNavDepth; }

  > nav,
  > navbar {
    z-index: 2 !important;
  }
}

//== Nav tweaks
.nav-condensed > li > a {
  padding-top: 2px;
  padding-bottom: 2px;
}

.navbar > .container-fluid {
  > .navbar-nav,
  > .navbar-form {
    &:not(.pull-right):first-child {
      // This is how .navbar-brand accomplishes it's solid placement
      margin-left: -15px;
      margin-top: 4px;
    }
  }
}

  .navbar-timepicker-time-desc > .fa-clock-o {
    padding-right: 5px;
  }

kbn-info i {
  cursor: help;
}

.kbn-timepicker .refresh-interval {
  padding: 0.2em 0.4em;
  border-radius: @border-radius-small;
}

.kbn-timepicker .refresh-interval-active {
  background-color: @brand-info;
  color: @white;
}

//== Table

kbn-table, .kbn-table {
  font-size: @font-size-small;

  th {
    white-space: nowrap;
    padding-right: 10px;

    .table-header-move {
      border: none;
      background: none;
      padding: 0;
    }

    .table-header-move, .table-header-sortchange {
      opacity: 0;

      &:focus {
        opacity: 1;
      }
    }

    .fa {
      font-size: 1.1em;
    }

  }

  th:hover {
    .table-header-move, .table-header-sortchange {
      opacity: 1;
    }
  }
}

//== Generic Table
table {
  td .fa {
    // font-awesome's override of the line-height usually doesn't
    // cauase problems, but in the table it pushes the icon to the
    // top of the row
    line-height: @line-height-base;
  }
}

//== SavedObjectFinder
saved-object-finder,
paginated-selectable-list {

  .list-sort-button {
    .border-top-radius(0) !important;
    border: none;
    padding: 8px 15px;
    font-weight: normal;
    background-color: @kibanaGray6;
  }

  ul.li-striped {
    li {
      border: none;
    }

    li:nth-child(even) {
      background-color: @kibanaGray6;
    }

    li:nth-child(odd) {
      background-color: @white;
    }

    .paginate-heading {
      font-weight: normal;
      color: @kibanaGray1;
    }

    .list-group-item {
      padding: 8px 15px;

      ul {
        padding: 0;
        display: flex;
        flex-direction: row;

        .finder-type {
          margin-right: 10px;
        }
      }

      a {
        i {
          color: @saved-object-finder-icon-color !important;
          margin-right: 10px;
        }

        display: block;
        color: @saved-object-finder-link-color !important;
      }

      &:first-child {
        .border-top-radius(0) !important;
      }

      &.list-group-no-results p {
        margin-bottom: 0 !important;
      }
    }
  }

  paginate {
    paginate-controls {
      margin: 20px;
    }
  }
}

//== inputDatetime
.input-datetime-format {
  font-size: @font-size-small;
  color: @text-muted;
  padding: @padding-base-vertical @padding-base-horizontal;
}

//== override the disabled cursor that doesn't work everywhere
.form-control{
  &[disabled],
  &[readonly],
  fieldset[disabled] & {
    cursor: default;
    opacity: .8;
  }
}

.fatal-body {
  white-space: pre-wrap;
}

.ng-dirty, .ng-touched {
  input.ng-invalid&,
  textarea.ng-invalid&,
  select.ng-invalid& {
    border-color: @state-danger-bg !important;
  }
}

input[type="radio"],
input[type="checkbox"],
.radio,
.radio-inline,
.checkbox,
.checkbox-inline {
  &[disabled],
  fieldset[disabled] & {
    cursor: default;
    opacity: .8;
  }
}

textarea {
  resize: vertical;
}

.field-collapse-toggle {
  color: @field-collapse-toggle-color;
  margin-left: 10px !important;
}

style-compile {
  display: none;
}

.tooltip-inner {
  white-space: pre-wrap !important;
}

@import '../filter_bar/filter_bar.less';


.cell-hover {
  position: relative;

  /**
   * 1. Center vertically regardless of row height.
   */
  .table-cell-filter {
    position: absolute;
    white-space: nowrap;
    right: 0;
    top: 50%; /* 1 */
    transform: translateY(-50%); /* 1 */
    display: none;
  }
}

  .cell-hover-show {
    // so that the cell doesn't change size on hover
    visibility: hidden;
  }

.cell-hover:hover {
  .table-cell-filter {
    display: inline;
  }

  .cell-hover-show {
    visibility: visible;
  }
}

mark, .mark {
  background-color: @mark-bg;
  border-radius: 2px;
}

fieldset {
  margin: @form-group-margin-bottom;
  padding: @form-group-margin-bottom;
  border: 1px solid @input-border;
  border-radius: @input-border-radius-base;
}

[fixed-scroll] {
  overflow-x: auto;
  padding-bottom: 0px;

  + .fixed-scroll-scroller {
    position: fixed;
    bottom: 0px;
    overflow-x: auto;
    overflow-y: hidden;
  }
}

.list-group {
  .list-group-item {
    &.active,
    &.active:hover,
    &.active:focus {
      background-color: @list-group-menu-item-active-bg;
      cursor: default;
    }
  }
}

// TODO: Extract these styles into the UI Framework.

.page-row {
  padding: 0 20px;
  margin: 20px 0;
}

.page-row-text {
  color: @kibanaGray2;
  font-size: 14px;
}

.kuiFormSection {
  margin-bottom: 16px;
}

.kuiFormSubSection {
  margin-bottom: 8px;
}

.kuiFormLabel {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
}

.kuiFormSubLabel {
  display: block;
  font-weight: normal;
}

  .kuiFormSubLabel__note {
    opacity: 0.5;
    margin-left: 4px;
    font-size: 12px;
  }

.kuiInputNote {
  margin: 5px 0 10px;
}

.kuiInputNote--danger {
  color: #E74C3C;
}

.kuiInputNote--warning {
  color: #F39C12;
}

/**
 * 1. Override label styles.
 */
.kuiOptionLabel {
  font-weight: normal; // 1
  cursor: pointer;
}

.kuiFormPanel {
  border: 1px solid #D4D4D4;
  padding: 12px;
}

.kuiList {
  margin-bottom: 10px;
}

.kuiListItem {
  padding: 12px 0;

  & + & {
    border-top: 2px dashed rgba(212, 212, 212, 0.5);
  }

  &:first-child {
    padding-top: 0;
  }

  &:last-child {
    padding-bottom: 0;
  }
}

/**
 * Utility class.
 */
.fullWidth {
  width: 100% !important;
}

/**
 * Utility class.
 */
.noPadding {
  padding: 0 !important;
}

/**
 * TODO: This is a generic pattern that should be replaced by specific components, e.g. inputGroup.
 */
.flexGroup {
  display: flex;
  width: 100%;
}

  .flexGroup__filler {
    flex: 1 1 auto;
  }

.kuiFormSection {
  margin-bottom: 16px;
}

.kuiFormLabel {
  display: block;
}

.kuiFormSubLabel {
  display: block;
  font-weight: normal;
}

.kuiSideBarSelect {
  // TODO: @include kuiSelect styles when this is moved to the UI Framework and we're using SASS.
  height: 24px;
  width: 100%;
  font-size: 12px;
  padding: 0 15px;
}

.kuiSideBarInput {
  // TODO: @include kuiInput styles when this is moved to the UI Framework and we're using SASS.
  display: block;
  width: 100%;
  height: 24px;
  font-size: 12px;
  color: #2d2d2d;
  border: 1px solid #D4D4D4;
  border-radius: 4px;
  padding: 5px 15px;
}

.kuiSideBarSection {
  margin-bottom: 10px;
  background-color: @globalColorWhite;
  padding: 10px;
  border-radius: 4px;
}

.kuiSideBarSection .kuiSideBarSection .kuiSideBarSection{
  border-radius: 0px;
  border-left: solid 1px tint(@globalColorBlue, 20%);
  margin-left: 3px; // Align to caret open
}


.kuiSideBarSection__main {
}

.kuiSideBarSectionTitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kuiSideBarSectionTitle__text {
  font-size: 18px;
  color: @globalColorDarkestGray;
}

/**
 * 1. Override Bootstrap button styles.
 */
.kuiSideBarSectionTitle__action {
  background-color: transparent; // 1
  padding: 0; // 1
  cursor: pointer;
  color: @globalColorBlue;
  border: none;

  &:hover {
    color: darken(@globalColorBlue, 10%);
  }
}

.kuiSideBarCollapsibleTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 10px;
}

.kuiSideBarCollapsibleTitle__label {
  display: flex;
  align-items: center;
}

/**
 * 1. Override FontAwesome .fa styles.
 */
.kuiSideBarCollapsibleTitle__caret {
  width: 14px;
  height: 14px;
  font-size: 14px !important; // 1
  color: @globalColorBlue;
}

.kuiSideBarCollapsibleTitle__text {
  font-size: 14px;
  color: @globalColorBlue;
}

/**
 * 1. Override Bootstrap button styles.
 */
.kuiSideBarCollapsibleTitle__action {
  background-color: transparent; // 1
  padding: 0; // 1
  cursor: pointer;
  color: @globalColorBlue;
  border: none;

  &:hover {
    color: darken(@globalColorBlue, 10%);
  }
}

.kuiSideBarCollapsibleSection {
}

/**
 * 1. Override Bootstrap h1 styles.
 */
.kuiSideBarFormSectionTitle {
  font-size: 12px;
  color: @globalColorMediumGray;
  margin: 10px 0 !important; // 1
  padding-bottom: 2px;
}

.kuiSideBarFormRow {
  display: flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 10px;
}

/**
 * 1. Override .vis-editor-sidebar styles.
 */
.kuiSideBarFormRow__label {
  display: flex;
  align-items: center;
  flex: 1 1 40% !important; // 1
  font-weight: 400;
}

.kuiSideBarFormRow__label__colorbox {
  width: 24px;
  height: 24px;
  display: inline-block;
  margin-right: 10px;
  border: 1px ridge lightgray;
}

.kuiSideBarFormRow__control {
  display: flex;
  align-items: center;
  flex: 1 1 60%;
}

/**
 * 1. Override .sidebar-item styles.
 */
.kuiSideBarOptionsLink {
  display: flex;
  align-items: baseline;
  font-size: 12px;
  color: @globalColorBlue !important; // 1

  &:hover {
    color: #105A73 !important; // 1
  }
}

.kuiSideBarOptionsLink__caret {
  width: 10px;
  height: 10px;
}

.kuiSideBarOptionsLink__text {
  margin-left: 2px;
}

.kuiGalleryItem__image img {
  width: 64px;
  height: 64px;
}

@import "~dragula/dist/dragula.css";
